﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

namespace TCS.Web.uc
{
    public partial class selectChange : System.Web.UI.UserControl
    {
        private string toadd = "├";
        protected void Page_Load(object sender, EventArgs e)
        {
            LTP.Accounts.Bus.User currentUser = (LTP.Accounts.Bus.User)Session["UserInfo"];

            LoadChildData(int.Parse(currentUser.DepartmentID));
           // LoadChildData(0);
        }
        private void LoadChildData(int parentid)
        {
            DataSet ds = new TCS.BLL.Gsp_Administrative().GetListNew(0, "parentid=" + parentid.ToString(), "addid");
            if (ds.Tables[0].Rows.Count > 0)
            {
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    this.dropParent.Items.Add(new ListItem(toadd + "" + ds.Tables[0].Rows[i]["AddName"].ToString(), ds.Tables[0].Rows[i]["ADDID"].ToString()));
                    toadd += "─┴";
                    LoadChildData(int.Parse(ds.Tables[0].Rows[i]["ADDID"].ToString()));
                    toadd = toadd.Substring(0, toadd.Length - 2);
                }
            }
        }

        protected void dropParent_SelectedIndexChanged(object sender, EventArgs e)
        {


        }
    }
}